
$(function(){
	play_index.run();	
});

var play_index = {	
		run: function(){
			this.__init__();			
			this._start_();
			this._bind_events();
		},
		
		__init__: function(){
			this.contextPath = $("#contextPath").val() || "";					
			this.itemUrl = $("#itemUrl").val();
			this.id = $("#id").val() || '';		
			this.title = $("#title").val() || '';			
			this.category = $("#category").val();
			this.website = $("#website").val();
			this.vdInstalled = vd.check();
		},
		
		_start_: function(){	
			var $li = $("#side_menu > ul > li");
			$li.eq(0).addClass("curr");
			main._play_close_side();
			main.addOrUpdateViewHistory(play_index.category,play_index.title,play_index.id);
			play_index._get_relate_video();
		},
		
		_bind_events: function(){			
			var locaIndex = location.href.indexOf("#"); 
			var localUrl = location.href;
			if(locaIndex > 0){
				localUrl = localUrl.substring(0,locaIndex);
			}
			$("#fb-comments").attr("data-href", localUrl);
			$(".loadingBox").show();
		},
		
		_get_relate_video: function(){						
			var url = main.contextPath + "/world/music/video/relate/" + this.id;
			$.get(url, function(result){
				$("#other_video").html(result.trim());
			});
		}	
};
